package com.tozed.test;

import com.tozed.widget.TitleBar;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class SpeakerTestActivity extends Base implements OnClickListener
{
	private TitleBar mTitleBar;
	private Button mBtnPass, mBtnFail;
	private Button mBtnStart;
	
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		setContentView(R.layout.phone_test);
		
		mTitleBar = (TitleBar)findViewById(R.id.title_bar);
		mTitleBar.setTiteText(R.string.str_test_speaker);
		mTitleBar.hideRightButton();
				
		mBtnPass = (Button)findViewById(R.id.btn_pass);
		mBtnFail = (Button)findViewById(R.id.btn_fail);
		mBtnPass.setOnClickListener(this);
		mBtnFail.setOnClickListener(this);
		
		mBtnStart = (Button)findViewById(R.id.btnStart);
		mBtnStart.setOnClickListener(this);
	}

	@Override
	public void onClick(View v)
	{
		switch (v.getId())
		{
		case R.id.btn_pass:
			Intent intent = new Intent();
			intent.putExtra("KEY_TEST_STATUS", 1);
			setResult(RESULT_OK, intent);
			finish();
			break;
			
		case R.id.btn_fail:
			Intent intent2 = new Intent();
			intent2.putExtra("KEY_TEST_STATUS", 0);
			setResult(RESULT_OK, intent2);
			finish();
			break;
			
		case R.id.btnStart:
			Intent intent1 = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:112")); 
			intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
			startActivity(intent1);
			break;
			
		default:
			break;
		}
	}

}
